package com.jinkaimen.kqb.ui.activity.h5toapp;

import android.support.v4.view.ViewPager;
import android.view.View;

import com.ht.baselibs.ui.base.BaseActivity;
import com.jinkaimen.kqb.R;
import com.jinkaimen.kqb.bean.MemberCardHomeBean;
import com.jinkaimen.kqb.ui.adapter.Member3DAdapter;
import com.jinkaimen.kqb.ui.adapter.RotationPageTransformer;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lixuebo on 17/7/28.
 */

public class GoUpgradeActivity extends BaseActivity {


    private ViewPager mViewPager;
    private List<MemberCardHomeBean.CardListBean> myGoUpgradeList;
    private Member3DAdapter mPagerAdapter;

    @Override
    protected boolean isStaticPage() {
        return true;
    }

    @Override
    protected void initTitleBar() {

        mTitleBarView.setTitleText("我要升级");
    }

    @Override
    protected int initContentView() {
        return R.layout.activity_go_upgrade;
    }

    @Override
    protected void initChildView() {
        mViewPager = (ViewPager) findViewById(R.id.viewpager_member_card);
    }

    @Override
    protected void initChildData() {
        myGoUpgradeList = new ArrayList();
        MemberCardHomeBean.CardListBean cardListBean = new MemberCardHomeBean.CardListBean();
        myGoUpgradeList.add(cardListBean);
        myGoUpgradeList.add(cardListBean);
        myGoUpgradeList.add(cardListBean);
        myGoUpgradeList.add(cardListBean);
        mViewPager.setPageTransformer(true, new RotationPageTransformer());
        mViewPager.setOffscreenPageLimit(4); //保证缓存
        mPagerAdapter = new Member3DAdapter(myGoUpgradeList, GoUpgradeActivity.this);
        GoUpgradeActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (myGoUpgradeList.size() > 0) {
                    mViewPager.setAdapter(mPagerAdapter);
                }
            }
        });
    }

    @Override
    protected void setChildViewListener() {
        mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            }

            @Override
            public void onPageSelected(int position) {
                if (myGoUpgradeList != null && myGoUpgradeList.size() - 1 >= position) {
                }
            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);

        switch (v.getId()) {
            case R.id.bt_share:


                break;
        }

    }

}
